﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
namespace CoreData
{
    public class Receipt_VoucherSales
    {
        public long ID { get; set; }
        public long Stock_VoucherOutID { get; set; }
        public string Payer { get; set; }
        public string Address { get; set; }
        public long VoucherID { get; set; }
        public int Money { get; set; }
        public bool IsDeleted { get; set; }

        public Receipt_VoucherSales()
        {
            Payer = "";
            Address = "";
        }

        static Receipt_VoucherSales DynamicCast<T>(object row_data, object row_header) where T : Receipt_VoucherSales
        {
            // row_data : DataRow
            // row_header : DataColumnCollection
            Receipt_VoucherSales ret = new Receipt_VoucherSales();
            DataRow dt = (DataRow)row_data;

            foreach (DataColumn column in (DataColumnCollection)row_header)
            {
                switch (column.ColumnName)
                {
                    case "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                        break;
                    case "Stock_VoucherOutID":
                        ret.Stock_VoucherOutID = ConvertObject.ToLong(dt[column]);
                        break;
                    case "Payer":
                        ret.Payer = ConvertObject.ToString(dt[column]);
                        break;
                    case "Address":
                        ret.Address = ConvertObject.ToString(dt[column]);
                        break;
                    case "VoucherID":
                        ret.VoucherID = ConvertObject.ToLong(dt[column]);
                        break;
                    case "Money":
                        ret.Money = ConvertObject.ToInt(dt[column]);
                        break;
                    case "IsDeleted":
                        ret.IsDeleted = ConvertObject.ToBool(dt[column]);
                        break;

                    default:
                        break;
                }
            }

            return ret;
        }

    }
}
